const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
  entry: __dirname + "/src/main.js", //唯一入口文件
  output: {
    path: __dirname + "/build", //打包后文件的存放路径
    filename: "bundle.js", //打包后文件的名称
  },
  devServer: {
    contentBase: "./public",
    historyApiFallback: true,
    inline: true,
  },
  module: {
    rules: [
      {
        test: /\.(scss|css)$/,
        use: ["style-loader", "css-loader", "sass-loader"],
      },
      {
        test: /\.clay$/,
        exclude: /node_modules/,
        loader: ["@csii/vx-clay/loader.js"],
      },
    ],
  },
  plugins: [
    new webpack.BannerPlugin("本项目为学习webpack搭建"),
    new HtmlWebpackPlugin({
      template: __dirname + "/index.temp.html",
    })
  ],
};
